layui.use(['form', 'element', 'jquery', 'button', 'popup','notice'], function() {
    var form = layui.form;
    var element = layui.element;
    var button = layui.button;
    var popup = layui.popup;
    var notice = layui.notice;
    var $ = layui.jquery;

    // 登 录 提 交
    form.on('submit(login)', function(data) {
        var requireData = data.field;
        //请求登入接口
        $.ajax({
            url:ADMIN_PATH+'/loginin',
            type:'post',
            data:{requireData},
            success:function(data){
                if(data){
                    notice.success(data.msg)
                    location.href = ADMIN_PATH;
                }else{
                    notice.error(data.msg)
                    $("#codeImage").attr('src',ADMIN_PATH+'/captcha?time'+Date.now());
                }
            }
        });
        return false;
    });

    //点击更新验证码
    $("#codeImage").click(function(){
        this.src = ADMIN_PATH+'/captcha?time'+Date.now();
    });
})